package io.kiki.stack.netty.protocol;

import io.kiki.stack.netty.command.CommandCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;


@Slf4j
//@Setter
@Getter
public enum CommonCommandCode implements CommandCode {

    request(CommandCode.request), response(CommandCode.response);

    private final short value;

    CommonCommandCode(short value) {
        this.value = value;
    }

    public static CommonCommandCode valueOf(short value) {
        switch (value) {
        case 1:
            return request;
        case 2:
            return response;
        }
        throw new IllegalArgumentException("Unknown Rpc command code value: " + value);
    }

    @Override
    public short value() {
        return this.value;
    }

}